import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {ContentPage} from "../content/content";
import {HttpServies} from"../../providers/http-servies";

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  providers:[HttpServies]
})
export class HomePage {
  dataJson:any=[];



  ionViewDidLoad() {
    this.getInfo();

  }
  constructor(public navCtrl: NavController,private http:HttpServies,public navParams: NavParams) {

  }
  contentPage(id){
    this.navCtrl.push(ContentPage,{id});
  }


  getInfo(){
    this.http.httpPost('/Home/index/news')
        .then(res => {
          if (res && res.code == 1) {
            console.log(res.msg);
            this.dataJson = res.data;
          }else {
            this.http.showErro(res.msg);
          }
        })
  }
}
